package juc.jmm;

import lombok.extern.slf4j.Slf4j;

import static juc.Sleeper.sleep;

@Slf4j(topic = "c.NoStop01")
public class NoStop01 {
        static boolean run = true;
        public static void main(String[] args) throws InterruptedException {
                Thread t = new Thread(()->{
                        while(run){
                                System.out.println("runing");
// ....
                        }
                        log.debug("t1线程结束了");
                },"t1");
                t.start();
                sleep(1);
                log.debug("停止");
                run = false; // 线程t不会如预想的停下来
        }
}
